﻿<%@ Register TagPrefix="ucCommon" TagName="Common" Src="../Common/Inc/Common.ascx" %>
<%@ Register TagPrefix="ucComment" TagName="Comment" Src="../Common/Inc/Comment.ascx" %>
<%@ Register TagPrefix="ucTop" TagName="Top" Src="../Common/Inc/Top.ascx" %>
<%@ Register TagPrefix="ucMenu" TagName="Menu" Src="../Common/Inc/Menu.ascx" %>
<%@ Register TagPrefix="ucTabTitle" TagName="TabTitle" Src="../Common/Inc/TabTitle.ascx" %>
<%@ Register TagPrefix="ucCopyright" TagName="Copyright" Src="../Common/Inc/Copyright.ascx" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Com1019m.aspx.cs" Inherits="Updms.Com.Com1019m" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>▒ UPDMS [Com1019m] ▒▒▒▒▒▒▒▒▒▒</title>
<ucCommon:Common id="Common" runat="server"></ucCommon:Common>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" id="ScriptManager1" EnableScriptGlobalization="true"></asp:ScriptManager>

<table id="table_frame">
	<tr>
		<td id="top_area" colspan="2">
			<!-- Top 시작 -->
			<ucTop:Top id="Top" runat="server"></ucTop:Top>
			<!-- Top 끝 -->
		</td>
	</tr>
	<tr>
		<td id="menu_area">
			<!-- 메뉴 시작 -->
			<ucMenu:Menu id="Menu" runat="server"></ucMenu:Menu>
			<!-- 메뉴 끝 -->
		</td>
		<td id="contents_area">
			<!-- 제목 시작 -->
			<ucTabTitle:TabTitle id="TabTitle" TagPrefixs="Com1019m" runat="server"></ucTabTitle:TabTitle>
			<!-- 제목 끝 -->
			<!-- AJAX 시작 -->
			<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<ContentTemplate>
			<!-- 버튼 시작 -->
			<div class="button_area">
				<asp:linkbutton id="ibtn_search" Text="검색" runat="server" CssClass="ibtn ibtn_search" OnClientClick="return chkSearch()" OnClick="ibtn_search_Click"></asp:linkbutton>
			</div>
			<!-- 버튼 끝 -->
			<!-- 검색 시작 -->
			<table class="table_search">
				<tr>
					<td class="lbl" width="11%"><asp:Literal ID="ltr_search_pgm_id" Text="프로그램" runat="server" /></td>
					<td class="ctl" width="22%"><asp:DropDownList id="ddl_search_pgm_id" runat="server" CssClass="ddl che"></asp:DropDownList></td>
					<td class="ctl" width="66%"></td>
				</tr>
			</table>
			<!-- 검색 끝 -->
			<!-- 리스트셋 시작 -->
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td width="39%" valign="top">
						<!-- 그리드관리 시작 -->
						<table id="table_grid" cellpadding="0" cellspacing="0" border="0" width="100%" runat="server">
							<tr>
								<td style="padding:10px 0 0 0;"><div class="sub_title_icon"><asp:Literal ID="ltr_stitle_grid_mgt" Text="그리드 관리" runat="server" /></div></td>
								<td><asp:linkbutton id="ibtn_delete" Text="삭제" runat="server" CssClass="ibtn ibtn_delete" OnClientClick="return chkDelete()" OnClick="ibtn_delete_Click"></asp:linkbutton><asp:linkbutton id="ibtn_save" Text="저장" runat="server" CssClass="ibtn ibtn_save" OnClientClick="return chkSave()" OnClick="ibtn_save_Click"></asp:linkbutton></td>
							</tr>
							<tr>
								<td colspan="2">
									<table class="table_detail">
										<tr>
											<td class="lbl" width="30%"><asp:Literal ID="ltr_grid_id" Text="그리드아이디" runat="server" /></td>
											<td class="ctl" width="70%"><asp:textbox id="txt_grid_id" runat="server" CssClass="ib_b req" Width="98%"></asp:textbox></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td colspan="2">
									<asp:GridView ID="GridView1" CssClass="table_gridview" GridLines="None" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridView1_RowDataBound" OnRowCommand="GridView1_RowCommand" DataKeyNames="Seq">
										<Columns>
											<asp:TemplateField HeaderText="&lt;a href=&quot;javascript:void(0);&quot; onclick=&quot;checkBoxCheck('GridView1');&quot;&gt;S&lt;/a&gt;">
												<ItemTemplate>
													<input id="cb_check" class="cb" type="checkbox" onclick="reverseRow('GridView1', 0);" runat="server" />
												</ItemTemplate>
												<ItemStyle HorizontalAlign="Center" Width="2%" />
											</asp:TemplateField>
											<asp:BoundField HeaderText="번호" >
												<ItemStyle HorizontalAlign="Center" Width="4%" />
											</asp:BoundField>
											<asp:BoundField DataField="Seq" HeaderText="Seq(X)" Visible="False" />
											<asp:BoundField DataField="Pgm_Id" HeaderText="프로그램" HtmlEncode="False" >
												<ItemStyle HorizontalAlign="Center" Width="16%" />
											</asp:BoundField>
											<asp:TemplateField HeaderText="그리드아이디">
												<ItemTemplate>
													<asp:LinkButton ID="lbtn_rc" runat="server" Text='<%# Bind("Grid_Id") %>'></asp:LinkButton>
												</ItemTemplate>
												<ItemStyle HorizontalAlign="Left" Width="32%" />
												<HeaderStyle CssClass="lbtn_rc" />
											</asp:TemplateField>
										</Columns>
										<EmptyDataTemplate>
											<div id="no_data"></div>
										</EmptyDataTemplate>
									</asp:GridView>
									<!-- 리스트 끝 -->
									<div class="div_left">Result : <asp:label id="lbl_result_count" runat="server"></asp:label></div>
								</td>
							</tr>
						</table>
						<!-- 그리드관리 끝 -->
					</td>
					<td width="1%"></td>
					<td width="60%" valign="top">
						<!-- 그리드별 컬럼관리 시작 -->
						<table id="table_grid_column" cellpadding="0" cellspacing="0" border="0" width="100%" runat="server">
							<tr>
								<td style="padding:10px 0 0 0;"><div class="sub_title_icon"><asp:Literal ID="ltr_stitle_grid_column_mgt" Text="그리드별 컬럼관리" runat="server" /></div></td>
								<td><asp:linkbutton id="ibtn_save_grid_column" Text="저장" runat="server" CssClass="ibtn ibtn_save" OnClientClick="return chkSaveGridColumn();" OnClick="ibtn_save_grid_column_Click"></asp:linkbutton></td>
								<td></td>
							</tr>
							<tr>
								<td align="left" colspan="2">
									<ul class="horizontal">
										<li style="width:20%;"><asp:dropdownlist id="ddl_label_initial" runat="server" Width="100%" CssClass="ddl" AutoPostBack="true" onselectedindexchanged="ddl_label_initial_SelectedIndexChanged"></asp:dropdownlist></li>
										<li style="width:55%;"><asp:dropdownlist id="ddl_label_id" runat="server" Width="100%" CssClass="ddl"></asp:dropdownlist></li>
										<li style="width:25%;"><asp:textbox id="txt_col_nm" runat="server" CssClass="ib_b" Width="99%" title="Column Name"></asp:textbox></li>
									</ul>
								 </td>
								<td style="padding:0 0 0 12px;"><asp:LinkButton id="lbtn_add_label" class="sbtn sbtn_add div_left" runat="server" ToolTip="추가" OnClientClick="return chkAddColumn();" OnClick="lbtn_add_label_Click" /></td>
							</tr>
							<tr>
								<td style="padding:3px 0 0 0;" colspan="3"></td>
							</tr>
							<tr>
								<td style="width:95%;" colspan="2"><asp:listbox id="lbox_grid_column" runat="server" width="100%" height="286" SelectionMode="Single" CssClass="che"></asp:listbox></td>
								<td style="padding:0 0 0 12px;width:5%;">
									<table cellpadding="0" cellspacing="0" border="0" width="100%">
										<tr>
											<td><asp:LinkButton id="lbtn_up_label" class="sbtn sbtn_arrow_t div_left" runat="server" ToolTip="위로" OnClick="lbtn_up_label_Click" /></td>
										</tr>
										<tr>
											<td style="height:20px;"></td>
										</tr>
										<tr>
											<td><asp:LinkButton id="lbtn_down_label" class="sbtn sbtn_arrow_b div_left" runat="server" ToolTip="아래로" OnClick="lbtn_down_label_Click" /></td>
										</tr>
										<tr>
											<td style="height:50px;"></td>
										</tr>
										<tr>
											<td><asp:LinkButton id="lbtn_del_label" class="sbtn sbtn_del div_left" runat="server" ToolTip="삭제" OnClick="lbtn_del_label_Click" /></td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
						<!-- 그리드별 컬럼관리 끝 -->
					</td>
				</tr>
			</table>
			<!-- 리스트셋 끝 -->
			<!-- 설명 시작 -->
			<ucComment:Comment id="Comment" runat="server" TagPrefixs="Com1019m"></ucComment:Comment>
			<!-- 설명 끝 -->
			<!-- 카피라이트 시작 -->
			<ucCopyright:Copyright id="Copyright" runat="server"></ucCopyright:Copyright>
			<!-- 카피라이트 끝 -->
			<!-- 히든값 시작 -->
			<div id="hdn_data">
				<asp:label id="lbl_pk" runat="server"></asp:label>
				<input id="h_no" type="hidden" name="h_no" runat="server" />
				<input id="h_seq" type="hidden" name="h_seq" runat="server" />
				<input id="h_pgm_id" type="hidden" name="h_pgm_id" runat="server" />
				<input id="h_grid_id" type="hidden" name="h_grid_id" runat="server" />
			</div>
			<!-- 히든값 끝 -->
			</ContentTemplate>
			</asp:UpdatePanel>
			<!-- AJAX 끝 -->
		</td>
	</tr>
</table>

<asp:updateprogress AssociatedUpdatePanelID="UpdatePanel1" ID="updateProgress1" runat="server">
	<progresstemplate>
		<div id="progressBackgroundFilter"></div>
		<div id="processMessage">
			<div id="processing"></div>
			<img src="../Common/Images/processing_img.gif" />
		</div>
	</progresstemplate>
</asp:updateprogress>

</form>

<script type="text/javascript" language="javascript" defer="defer">
	//상위시스템 선택불가
	function chkDisableOption(obj) {
		if (obj[obj.selectedIndex].value == "") {
			msgBox.alert(getMsg(MSG_ERR_015)); //하위프로그램만 선택해주세요
			obj.selectedIndex = 0;
			return;
		}
	}

	//검색
	function chkSearch() {
		if ($F("ddl_search_pgm_id").blank()) {
			msgBox.alert(getMsg(MSG_ERR_015), setFocus, "ddl_search_pgm_id"); //하위프로그램만 선택해주세요
			return false;
		}
	}
	
	//저장
	function chkSave() {
		if ($F("ddl_search_pgm_id").blank()) {
			msgBox.alert(getMsg(MSG_ERR_015), setFocus, "ddl_search_pgm_id"); //하위프로그램만 선택해주세요
			return false;
		}

		if ($F("txt_grid_id").blank()) {
			msgBox.alert(getMsg(MSG_ERR_160), setFocus, "txt_grid_id"); //그리드아이디를 입력해주세요
			return false;
		}

		var max_char = 50;
		if ($F("txt_grid_id").length > max_char) {
			msgBox.alert(getMsg(MSG_ERR_188, [max_char]), setFocus, "txt_grid_id"); //50자를 초과할 수 없습니다
			return false;
		}

		if ($("h_pgm_id").value != "" && $("h_pgm_id").value != $("ddl_search_pgm_id").value) {
			msgBox.alert(getMsg(MSG_ERR_159), setFocus, "ddl_search_pgm_id"); //다른 프로그램으로 저장할 수 없습니다
			return false;
		}

		msgBox.confirm(getMsg(MSG_CFM_000), doSave); //저장하시겠습니까?
		return false;
	}
	
	//저장 - 그리드컬럼
	function chkSaveGridColumn() {
		if ($F("ddl_search_pgm_id").blank()) {
			msgBox.alert(getMsg(MSG_ERR_015), setFocus, "ddl_search_pgm_id"); //하위프로그램만 선택해주세요
			return false;
		}

		if ($F("h_seq").blank()) {
			msgBox.alert(getMsg(MSG_ERR_160), setFocus, "txt_grid_id"); //그리드아이디를 선택하여 입력해주세요
			return false;
		}

		if ($("h_pgm_id").value != "" && $("h_pgm_id").value != $("ddl_search_pgm_id").value) {
			msgBox.alert(getMsg(MSG_ERR_159), setFocus, "ddl_search_pgm_id"); //다른 프로그램으로 저장할 수 없습니다
			return false;
		}

		msgBox.confirm(getMsg(MSG_CFM_000), doSaveGridColumn); //저장하시겠습니까?
		return false;
	}	

	function doSaveGridColumn() {
		if (isMsgBoxYes()) {
			__doPostBack('ibtn_save_grid_column', '');
		}
	}

	//컬럼 추가체크
	function chkAddColumn() {
		if ($F("ddl_label_id").blank()) {
			msgBox.alert(getMsg(MSG_ERR_158), setFocus, "ddl_label_id"); //라벨을 선택해주세요
			return false;
		}
	}
	
	//삭제
	function chkDelete() {
		if(!isCheckedOnGridView("GridView1", 0)) {
			msgBox.alert(getMsg(MSG_ERR_053));	//삭제할 항목을 선택하세요
			return false;
		}

		if ($("h_pgm_id").value != "" && $("h_pgm_id").value != $("ddl_search_pgm_id").value) {
			msgBox.alert(getMsg(MSG_ERR_161), setFocus, "ddl_search_pgm_id"); //다른 프로그램으로 삭제할 수 없습니다
			return false;
		}

		msgBox.confirm(getMsg(MSG_CFM_022), doDelete); //삭제하시겠습니까?\n등록된 모든 그리드별 컬럼정보도 함께 삭제됩니다
		return false;
	}
	
</script>
</body>

</html>
